package com.jt.mapper;

import com.jt.pojo.User;
import com.jt.vo.PageResult;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

public interface UserMapper {
    List<User> findAll();

    @Select("select * from user where username=#{username} and password = #{password}")
    User findUserByUP(User user);

    List<User> getUserListByPage(PageResult pageResult);

    @Select("select count(1) from user")
    long findTotal(PageResult pageResult);

    List<User> getUserListByPage(@Param("size") int size,
                                 @Param("start") int start,
                                 @Param("query") String query);

    int changById(User user);

    int addUser(User user);

@Select("select * from user where id = #{id}")
    User findUserById(Integer id);

    void updateUser(User user);
@Delete("delete from user where id=#{id}")
    void deleteUserById(Integer id);
}
